﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
using Microsoft.LightSwitch.Threading;

namespace LightSwitchApplication {
    public partial class UserLogout {      
        partial void OkMethod_Execute() {            
            this.Application.CurrentUser = this.DataWorkspace.FtgQcData.Users_Single("Visitor");
            CloseScreen("UserLogout");
        }

        void CloseScreen(string ScreenName) {
            Dispatchers.Main.BeginInvoke(() => {
                Application.ActiveScreens.Where(p => p.Screen.Name == ScreenName).FirstOrDefault().Close(false);
            });
        }

        partial void UserLogout_Activated() {
            this.OpenModalWindow("UserLogoutModalWindow");
        }    
    }
}
